﻿// Inner Fire 游戏引擎库
// 阴影贴图
//
// Copyright (c) 2024 by 尔西大帝. All rights reserved.
// 根据《DirectX12游戏开发实战》中的工具类修改。原作者：Frank Luna
//
// 这个类用于阴影贴图
//
// Author: 尔西大帝
// Email: 2670613871@qq.com
// Created: 2024-12-04

#pragma once

#include <dx/texture/render_texture.h>

namespace ifire::dx {

class ShadowMap : public RenderTexture {
public:
  ShadowMap(ID3D12Device* device, UINT width, UINT height);
  ShadowMap(const ShadowMap& rhs) = delete;
  ShadowMap& operator=(const ShadowMap& rhs) = delete;
  ~ShadowMap() = default;


  void BuildDescriptors(CD3DX12_CPU_DESCRIPTOR_HANDLE handle_cpu_srv,
      CD3DX12_GPU_DESCRIPTOR_HANDLE handle_gpu_srv,
      CD3DX12_CPU_DESCRIPTOR_HANDLE handle_cpu_dsv);
  
  CD3DX12_CPU_DESCRIPTOR_HANDLE mCpuSrv;
  CD3DX12_GPU_DESCRIPTOR_HANDLE mGpuSrv;
  CD3DX12_CPU_DESCRIPTOR_HANDLE mCpuDsv;
protected:
  void BuildDescriptors() override;
  void BuildResource() override;
};

} // namespace ifire
